package com.hnust.dao;

import com.hnust.domain.Anno;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface AddAnnotationDao {

    //    根据testId找到paperId
    @Select("select topaperid from test where testid=#{testId}")
    public String queryPapIdByTestId(String testId);

//    根据testId找到paperId,再根据paperid找到que_id
    @Select("select que_id from test t,question_paper as qp where t.testid=#{testId} and t.topaperid=qp.pap_id and qp.que_id=#{queId}")
    public String queryQueIdByTestId(String testId,String queId);

//    根据testid找到stuid
    @Select("select stu_id from test_class_group as tcg,student as stu where tcg.testid=#{testId} and tcg.cla_id=stu.cls_id and stu.stu_id=#{stuId}")
    public String queryStuIdByTestId(String testId,String stuId);

//    往批注表中插入一条批注信息
    @Insert("insert into anno values(#{annoId},#{stuId},#{papId},#{queId},#{annoMsg})")
    public int addAnnotation(Anno anno);



//
}
